﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html class="x-admin-sm">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>人员岗位</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/Content/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/Content/X-admin/lib/layui/layui.js"></script>
    <link href="~/Content/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/Content/X-admin/js/jquery.min.js"></script>
    <script src="~/Content/X-admin/js/xadmin.js"></script>
    <script src="~/Content/Scripts/System/systemFrame.js"></script>
    <script src="~/Content/Scripts/System/Common.js"></script>

</head>
<body>
    <span style="margin-top:15px;margin-left:15px">
        <xblock>
            <button class="layui-btn" onclick="saveData()"><i class="layui-icon"></i>保存</button>
            <button class="layui-btn" onclick="closeWin()"><i class="layui-icon">&#x1006;</i>取消</button>
        </xblock>
    </span>

    <div style="margin: 20px; border: 1px solid #dbdbdb;padding:15px">

        <form id="AddForm" class="layui-form layui-col-space5">

            <div class="layui-form-item layui-form-text">
                <label for="desc" class="layui-form-label">生产人员</label>
                <div class="layui-input-block">
                    <input type="text" id="usersName" name="usersName" class="layui-input" onclick="chooseUser()"  />
                    <input type="hidden" id="usersCode" name="usersCode" />
                </div>
            </div>
            <div class="layui-form-item layui-form-text">

                <label class="layui-form-label">
                    生产工序
                </label>
                <div class="layui-input-inline">
                    <select id="gxCode" name="gxCode" lay-filter="gx">
                        <option value="">选择工序</option>
                    </select>
                </div>
                <label class="layui-form-label">
                  生产机台
                </label>
                <div class="layui-input-inline">
                    <select id="machine" name="machine" >
                        <option value="">生产机台</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">
              生产岗位
                </label>
                <div class="layui-input-inline">
                    <select name="gangwei" id="gangwei" class="gw">
                        <option value="">选择岗位</option>
                    </select>
                </div>
                <label for="L_email" class="layui-form-label">
            生产占比
                </label>

                <div class="layui-input-inline">
                    <input type="text" id="zhanbi" name="zhanbi" class="layui-input" >
                    
                </div>
              <input id="id" name="id" type="hidden" />
            </div>
        </form>
   
        
        
    </div>
</body>
</html>
<script type="text/javascript">
    var dataId = "";
    var u8Code = "";
    $(function () {
        dataId = getUrlVariable("dataId");
        CommonData("Gx", "gxCode", "");
        CommonData('scgw', "gangwei","");
        if (dataId != "0") {
            $("input[ name='id']").val(dataId);
            loadData(dataId);
        }
      
        layui.use('form', function () {
            var form = layui.form;
            form.on('select(gx)', function (data) {

                GongXuMachine(data.value, "machine","");
         
                
            });
        });
    });
    /**客户档案**/
    function chooseUser() {
            InfoOpenPage("../Common/selectUser?isSingle=0", "选择人员", "90%", "90%");
    }
  
   
    // 保存数据
    function saveData() {
        $.ajax({
            url: "../Basis/SaveUserPosition",
            type: "post",
            data: { datas: JSON.stringify(FormToJson("AddForm")) },
            success: function (data) {
                if (data.Result) {
                    layer.msg("岗位信息设置成功");
                } else {
                    layer.msg(data.Message);
                }
            }
        });
    }

    //加载数据信息
    function loadData(code) {
        $.ajax({
            url: "../Plan/getPlanInfoByCode",
            type: "post",
            data: { plCode: code },
            async: false,
            success: function (data) {
                if (data.Result) {
                    $.each(data.Data[0], function (name, value) {
                        $("input[ name='" + name + "']").val(value);
                    });
                    SetCheckBoxValue("proGx", data.Data[0].process);
                    var json = JSON.parse(data.Data[0].c_caizhi);
                    $.each(json, function (name, value) {
                        $("input[ name='" + name + "']").val(value);
                    });
                }
            }
        });
    }
  
  
</script>